#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:namespace.py
# author:wmf
# datetime:2021/3/25 14:15
# software: PyCharm
'''
this is function description
'''
# import module your need

import builtins

# print(dir(builtins))
print("局部变量num")
def demo1():
    num = 10
    print(num)
    num = 20
    print("修改后 %d" % num)

def demo2():
    num = 100
    print(num)

demo1()
demo2()

print("over")

print("全局变量num")
num = 10
def demo1():
    print(num)

def demo2():
    print(num)

demo1()
demo2()

print("over")

num = 1
def fun1():
    global num  # 需要使用 global 关键字声明
    print(num)
    num = 123
    print(num)
fun1()
print(num)

